import { uniqueId } from 'lodash'

// 插件
import demoPlugins from './modules/demo-plugins'
// 组件
import demoComponents from './modules/demo-components'
// 功能
import demoPlayground from './modules/demo-playground'
//自定义
import demo from './modules/demo-custom'
//课程发布
import course from './modules/releasecourse'
//课程选择
import course_selection from './modules/course_selection'
//课程管理
import course_adm from './modules/adm_course'

/**
 * @description 给菜单数据补充上 path 字段
 * @description https://github.com/d2-projects/d2-admin/issues/209
 * @param {Array} menu 原始的菜单数据
 */
function supplementPath (menu) {
  return menu.map(e => ({
    ...e,
    path: e.path || uniqueId('d2-menu-empty-'),
    ...e.children ? {
      children: supplementPath(e.children)
    } : {}
  }))
}

// 菜单 侧边栏
export const menuAside = supplementPath([
 JSON.parse( localStorage.getItem('menu'))||{
  title:'首页', 
   icon:'home',
   path:'/index',
   children:[
     {
       title:'首页',
       path:'/index',
       icon:'home'
     }
   ]
}
])




// 菜单 顶栏
export const menuHeader = supplementPath([
  JSON.parse(  localStorage.getItem('menu'))||{
    title:'首页', 
     icon:'home',
     path:'/index',
     children:[
       {
         title:'首页',
         path:'/index',
         icon:'home'
       }
     ]
  }
 
])
